<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax</title>
    <script src="/static/js/jquery.min.js"></script>
    <script>
        $(function () {
            $('#btnAjax').click(function () {
                alert(1)
                $.ajax({
                        'url':'/ajax_handle',
                        'type':'get',
                        'dataType':'json',
                        'async':false, //同步的ajax请求
                    }).success(function (data) {
                        alert('2')
                        //进行处理
                    if (data.res == 1){
                         $('#message').show().html('提示信息')
                    }
                    else
                        $('#message').show().html('错误')
                })
                alert(3)
            })
        })

    </script>
    <style>
        #message{
            display: none;
            color: red;
        }
        </style>
</head>
<body>
<input type="button" id="btnAjax" value="ajax请求">
<div id="message"></div>
</body>
</html>